package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {

    /**
     * 根据openid查询用户
     *
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid};")
    User getByOpenId(String openid);

    /**
     * 插入用户
     *
     * @param user1
     * @return
     */
    int insert(User user1);

    /**
     * 根据id查询
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);


    /**
     * 所有的用户数量
     * @return
     */
    @Select("select count(*) from user;")
    Integer countAll();

    /**
     * 查询当天的用户数量
     * @param map
     * @return
     */
//    @Select("select count(*) from user where create_time > #{beginTime} and create_time < #{endTime};")
    Integer sumByMap(Map map);
}
